package com.minimalist.common.entity.lindi.vo.contracttemplate;

import cn.hutool.core.date.DatePattern;
import com.fasterxml.jackson.annotation.JsonFormat;
import com.fasterxml.jackson.databind.annotation.JsonSerialize;
import com.fasterxml.jackson.databind.ser.std.ToStringSerializer;
import com.minimalist.common.config.swagger.SchemaEnum;
import com.minimalist.common.entity.basic.vo.file.FileVO;
import com.minimalist.common.entity.lindi.enums.LindiContractTemplateEnum;
import com.minimalist.common.entity.lindi.vo.contracttemplatefield.LindiContractTemplateFieldVO;
import com.minimalist.common.utils.Add;
import com.minimalist.common.utils.Update;
import io.swagger.v3.oas.annotations.media.Schema;
import jakarta.validation.constraints.NotBlank;
import jakarta.validation.constraints.NotNull;

import java.io.Serial;
import java.io.Serializable;
import java.time.LocalDateTime;
import java.util.List;
import java.util.Objects;

/**
 * 林地指标平台_合同模板VO
 *
 * @author 11987
 * @since 2025-05-31
 */

@Schema(name = "林地指标平台_合同模板实体")
public class LindiContractTemplateVO implements Serializable{
    @Serial
    private static final long serialVersionUID = 1L;

    @NotNull(message = "合同模板ID不能为空", groups = {Update.class})
    @JsonSerialize(using = ToStringSerializer.class)
    @Schema(name = "contractTemplateId", description = "合同模板ID", type = "string")
    private Long contractTemplateId;

    @NotBlank(message = "模板名称不能为空", groups = {Add.class, Update.class})
    @Schema(name = "contractTemplateName", description = "模板名称", type = "string")
    private String contractTemplateName;

    @SchemaEnum(implementation = LindiContractTemplateEnum.ContractTemplateTypeEnum.class)
    @NotNull(message = "模板类型不能为空", groups = {Add.class, Update.class})
    @Schema(name = "contractTemplateType", description = "模板类型", type = "integer")
    private String contractTemplateType;

    @SchemaEnum(implementation = LindiContractTemplateEnum.StatusEnum.class)
    @Schema(name = "status", description = "状态 0禁用 1正常", type = "integer")
    private Integer status;

    @Schema(name = "contractDescription", description = "模板描述", type = "string")
    private String contractDescription;

    @JsonSerialize(using = ToStringSerializer.class)
    @Schema(name = "contractTemplateFileId", description = "合同模板文件ID", type = "string")
    private Long contractTemplateFileId;

    @Schema(name = "contractTemplateFile", description = "合同模板文件信息")
    private FileVO contractTemplateFile;

    @Schema(name = "fields", description = "字段配置列表")
    private List<LindiContractTemplateFieldVO> fields;

    @JsonSerialize(using = ToStringSerializer.class)
    @Schema(name = "createId", description = "创建人ID", type = "string")
    private Long createId;

    @JsonSerialize(using = ToStringSerializer.class)
    @Schema(name = "updateId", description = "更新人ID", type = "string")
    private Long updateId;

    @Schema(name = "createTime", description = "创建时间", type = "string")
    @JsonFormat(pattern = DatePattern.NORM_DATETIME_PATTERN)
    private LocalDateTime createTime;

    @Schema(name = "updateTime", description = "更新时间", type = "string")
    @JsonFormat(pattern = DatePattern.NORM_DATETIME_PATTERN)
    private LocalDateTime updateTime;

    public LindiContractTemplateVO(){
    }

    public Long getContractTemplateId(){
        return contractTemplateId;
    }

    public void setContractTemplateId(Long contractTemplateId){
        this.contractTemplateId = contractTemplateId;
    }

    public String getContractTemplateName(){
        return contractTemplateName;
    }

    public void setContractTemplateName(String contractTemplateName){
        this.contractTemplateName = contractTemplateName;
    }

    public String getContractTemplateType(){
        return contractTemplateType;
    }

    public void setContractTemplateType(String contractTemplateType){
        this.contractTemplateType = contractTemplateType;
    }

    public Integer getStatus(){
        return status;
    }

    public void setStatus(Integer status){
        this.status = status;
    }

    public String getContractDescription(){
        return contractDescription;
    }

    public void setContractDescription(String contractDescription){
        this.contractDescription = contractDescription;
    }

    public Long getContractTemplateFileId(){
        return contractTemplateFileId;
    }

    public void setContractTemplateFileId(Long contractTemplateFileId){
        this.contractTemplateFileId = contractTemplateFileId;
    }

    public FileVO getContractTemplateFile(){
        return contractTemplateFile;
    }

    public void setContractTemplateFile(FileVO contractTemplateFile){
        this.contractTemplateFile = contractTemplateFile;
    }

    public List<LindiContractTemplateFieldVO> getFields(){
        return fields;
    }

    public void setFields(List<LindiContractTemplateFieldVO> fields){
        this.fields = fields;
    }

    public Long getCreateId(){
        return createId;
    }

    public void setCreateId(Long createId){
        this.createId = createId;
    }

    public Long getUpdateId(){
        return updateId;
    }

    public void setUpdateId(Long updateId){
        this.updateId = updateId;
    }

    public LocalDateTime getCreateTime(){
        return createTime;
    }

    public void setCreateTime(LocalDateTime createTime){
        this.createTime = createTime;
    }

    public LocalDateTime getUpdateTime(){
        return updateTime;
    }

    public void setUpdateTime(LocalDateTime updateTime){
        this.updateTime = updateTime;
    }

    @Override
    public boolean equals(Object o){
        if (this == o){
            return true;
        }
        if (o == null || getClass() != o.getClass()){
            return false;
        }
        LindiContractTemplateVO that = (LindiContractTemplateVO) o;
        return Objects.equals(contractTemplateId, that.contractTemplateId) && Objects.equals(contractTemplateName, that.contractTemplateName) && Objects.equals(contractTemplateType, that.contractTemplateType) && Objects.equals(status, that.status) && Objects.equals(contractDescription, that.contractDescription) && Objects.equals(contractTemplateFileId, that.contractTemplateFileId) && Objects.equals(contractTemplateFile, that.contractTemplateFile) && Objects.equals(fields, that.fields) && Objects.equals(createId, that.createId) && Objects.equals(updateId, that.updateId) && Objects.equals(createTime, that.createTime) && Objects.equals(updateTime, that.updateTime);
    }

    @Override
    public int hashCode(){
        return Objects.hash(contractTemplateId, contractTemplateName, contractTemplateType, status, contractDescription, contractTemplateFileId, contractTemplateFile, fields, createId, updateId, createTime, updateTime);
    }

    @Override
    public String toString(){
        return "LindiContractTemplateVO{" +
                "contractTemplateId=" + contractTemplateId +
                ", contractTemplateName='" + contractTemplateName + '\'' +
                ", contractTemplateType='" + contractTemplateType + '\'' +
                ", status=" + status +
                ", contractDescription='" + contractDescription + '\'' +
                ", contractTemplateFileId=" + contractTemplateFileId +
                ", contractTemplateFile=" + contractTemplateFile +
                ", fields=" + fields +
                ", createId=" + createId +
                ", updateId=" + updateId +
                ", createTime=" + createTime +
                ", updateTime=" + updateTime +
                '}';
    }
}
